<!DOCTYPE html>
<html lang="en">
<!--header-->
<include file="Public:header"/>
<!--header-->
<section id="main-content">
    <section class="wrapper">
        <h3><i class="fa fa-angle-right"></i> 添加/修改常见问题</h3>

        <!-- BASIC FORM ELELEMNTS -->
        <div class="row mt">
            <div class="col-lg-12">
                <div class="form-panel">
                    <h4 class="mb">
                        <i class="fa fa-angle-right"></i> 常见问题信息
                        <a class="btn btn-theme btn-default" href="{:U('index')}">返回</a>
                    </h4>

                    <form id="myForm" class="form-horizontal style-form" method="post" action="{:U('add')}"  enctype="multipart/form-data">
                        <div class="form-group" id="title">
                            <label class="col-sm-2 col-sm-2 control-label">问题名称</label>
                            <div class="col-sm-10">
                                <input name="title" value="{$list.title}" type="text"  class="form-control" placeholder="请输入问题名称">
                            </div>
                        </div>
                        <div id="content" class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label">问题答案</label>
                            <div class="col-sm-10">
                                <textarea name="content" class="input" cols="57px" rows="15px;" placeholder="请输入问题答案">{$list.content}</textarea>
                            </div>
                        </div>
                        <input type="hidden"  name="id" value="{$list.id}">
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 control-label"></label>
                            <div class="col-sm-10">
                                <input  type="button" id="tianjia" class="btn btn-theme" value="保存" style="width: 150px;margin-left: 60px">
                                <input  type="reset" class="btn btn-warning" value="重置" style="width: 150px">
                            </div>
                        </div>
                    </form>
                </div>
            </div><!-- col-lg-12-->
        </div><!-- /row -->
    </section>
</section>
<!--footer-->
<include file="Public:footer"/>
<!--footer-->
<script type="text/javascript" src="__PUBLIC__/ui/lib/layer/2.4/layer.js"></script>
<script>
    $("#tianjia").click(function(){
        var form = new FormData(document.getElementById("myForm"));
        $.ajax({
            url:"{:U('add')}",
            data:form,
            type:"post",
            processData:false,
            contentType:false,
            success:function (res) {
                if(res.status == 1){
                    layer.open({
                        title: '提示：',content: '答案信息填写不完整，操作失败！'
                    });
                }
                if(res.status == 2){
                    layer.open({
                        title: '提示：',content: '操作成功！'
                    });
                }
                if(res.status == 3){
                    layer.open({
                        title: '提示：',content: '操作失败！'
                    });
                }
            }
        })
    });
</script>

</body>
</html>


